/**
 * @author: Miss.杨
 * @date: 2025年3月08日 16:00:47
 * @description: 
 */
package com.sheepone.monitor.audit.server;

import java.util.HashMap;
import java.util.List;

import com.sheepone.monitor.audit.core.entities.ModuleSelectableInfo;

/**
 * @author: Miss.杨
 * @date: 2025年3月08日 16:00:47
 * @description:
 */
public class GlobalServiceRouter {
    private final static HashMap<String, ModuleRouter> moduleRouters = new HashMap<>();

    public static void register(String service, ModuleRouter moduleRouter) {
        moduleRouters.put(service, moduleRouter);
    }

    public static void registerAll(HashMap<String, ModuleRouter> moduleRouters) {
        GlobalServiceRouter.moduleRouters.putAll(moduleRouters);
    }

    public static ModuleRouter route(String service) {
        return moduleRouters.get(service);
    }

    public static List<ModuleSelectableInfo> getServiceConfig(String service) {
        ModuleRouter moduleRouter = route(service);
        return moduleRouter.getModuleSelectableList();
    }

}
